#include <windows.h>
#include <cesync.h>
#include "DataHandler.h"


BOOL WINAPI DllMain( HANDLE hInstDll, ULONG ulReason, LPVOID lpReserved )
{
    switch( ulReason )
    {
    case DLL_PROCESS_ATTACH :
        break;

    case DLL_PROCESS_DETACH:
        break;

    case DLL_THREAD_ATTACH:
        break;

    case DLL_THREAD_DETACH:
        break;

    }
    return TRUE;
}

/*
InitObjType is called by the ActiveSync manager when your provider is about
to be started and terminated. Here is a place where you may perform any desired
initialization or cleanup. 
*/
EXTERN_C BOOL InitObjType( LPWSTR lpszObjType, IReplObjHandler **ppObjHandler, UINT uPartnerBit )
{
	MessageBox(NULL, LPCTSTR(_T("InitObjType")), NULL, MB_OK);

	if (lpszObjType == NULL)
	{
		//do sth. for cleanup.
		return TRUE;
	}
//do sth. for initialization here.
	*ppObjHandler = new CDataHandler();
	return TRUE;
}

/*
 When any change occurs in a Windows CE object store, all available (loaded, actually) 
 ActiveSync Service Providers are notified of what has happened.
*/
EXTERN_C BOOL ObjectNotify( POBJNOTIFY pNotify )
{
	MessageBox(NULL, LPCTSTR(_T("ObjectNotify")), NULL, MB_OK);
	return TRUE;
}

/*
 At the moment ActiveSync manager is about to perform some action on your data, 
 it needs to gather information about what's being synchronized.
*/
EXTERN_C BOOL GetObjTypeInfo( POBJTYPEINFO pInfo )
{
//	MessageBox(NULL, LPCTSTR(_T("GetObjTypeInfo")), NULL, MB_OK);
	return TRUE;
}

/* This device module function is called by the server to locate objects in the
   device's object store.
 */
EXTERN_C HRESULT FindObjects( PFINDOBJINFO pfi )
{
	MessageBox(NULL, LPCTSTR(_T("FindObjects")), NULL, MB_OK);
	return TRUE;
}

EXTERN_C BOOL SyncData( PSDREQUEST psd )
{
	MessageBox(NULL, LPCTSTR(_T("SyncData")), NULL, MB_OK);
	return TRUE;
}

/* ActiveSync calls this function to inform about various events occuring
   during the synchronization session.
 */
EXTERN_C BOOL ReportStatus( LPWSTR lpszObjType, UINT uCode, UINT uParam )
{
	switch(uCode)
    {
    case RSC_BEGIN_SYNC:
        break;
    case RSC_END_SYNC:
        break;
    }
	MessageBox(NULL, LPCTSTR(_T("ReportStatus")), NULL, MB_OK);
    return TRUE;
}
